package com.linhh.mall.center.common.pojo;

import java.util.ArrayList;

/**
 *
 * @Author linhh
 * @Date 2023 03 20 10 13
 **/
public class LandDatabase {
    private ArrayList<TbLandRegistration> registrations;
    private ArrayList<ArrayList<TbLandCoordinate>> coordinates;
    private ArrayList<TbLandAttachment> attachments;

    public LandDatabase() {
        registrations = new ArrayList<>();
        coordinates = new ArrayList<>();
        attachments = new ArrayList<>();
    }

    // 增加土地执法登记
    public void addRegistration(TbLandRegistration registration) {
        registrations.add(registration);
    }

    // 增加宗地空间信息
    public void addCoordinates(ArrayList<TbLandCoordinate> coords) {
        coordinates.add(coords);
    }

    // 增加附件信息
    public void addAttachment(TbLandAttachment attachment) {
        attachments.add(attachment);
    }

    // 根据宗地编号查找土地执法登记
    public TbLandRegistration findRegistrationById(String id) {
        for (TbLandRegistration registration : registrations) {
            if (registration.getId().equals(id)) {
                return registration;
            }
        }
        return null;
    }

    // 根据点号查找宗地空间信息
    public ArrayList<TbLandCoordinate> findCoordinatesByPointNumber(int pointNumber) {
        for (ArrayList<TbLandCoordinate> coords : coordinates) {
            for (TbLandCoordinate coord : coords) {
                if (coord.getPointNumber() == pointNumber) {
                    return coords;
                }
            }
        }
        return null;
    }

    // 根据宗地编号查找附件信息
//    public LandAttachmentInfo findAttachmentById(String id) {
//        for (LandAttachmentInfo attachment : attachments) {
//            if (attachment.getId().equals(id)) {
//                return attachment;
//            }
//        }
//        return null;
//    }
}
